shortcutswindow: Unset search_bar in dispose
authorTimm Bäder <mail@baedert.org>
Thu, 12 Jan 2017 16:13:19 +0000 (17:13 +0100)
committerTimm Bäder <mail@baedert.org>
Fri, 20 Jan 2017 20:33:37 +0000 (21:33 +0100)
And check for null-ness in unmap. This prevents a crash when the window
is first disposed and then unmapped.

gtk/gtkshortcutswindow.c

index bcdc49ae3d53e89ef907b9dbc297ea493f0d5c91..952b01d9a021d6fe4b0a2859e360ec0d919ffad9 100644 (file)
@@ -669,6 +669,7 @@ gtk_shortcuts_window_dispose (GObject *object)
       gtk_container_remove (GTK_CONTAINER (self), GTK_WIDGET (priv->main_box));
       priv->main_box = NULL;
       priv->stack = NULL;
+      priv->search_bar = NULL;
     }
 
   G_OBJECT_CLASS (gtk_shortcuts_window_parent_class)->dispose (object);
@@ -739,7 +740,8 @@ gtk_shortcuts_window_unmap (GtkWidget *widget)
   GtkShortcutsWindow *self = (GtkShortcutsWindow *)widget;
   GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self);
 
-  gtk_search_bar_set_search_mode (priv->search_bar, FALSE);
+  if (priv->search_bar)
+    gtk_search_bar_set_search_mode (priv->search_bar, FALSE);
 
   GTK_WIDGET_CLASS (gtk_shortcuts_window_parent_class)->unmap (widget);
 }